$(function(){
    var inland = [];
    console.log(inland);
    $.ajax({
        url:"http://193.112.55.79:9090/api/getinlanddiscount",
        dataType:"json",
        success:function(result){
            console.log(result);
            for(var i=0;i<16;i++){
              var inla =  result.result.shift();
              inland.push(inla);
            }
            console.log(inland);
            var html = template("listO",{"item":inland})
            $(".listOption").html(html);
            // console.log(result);
             $(window).scroll(function(){
                //  console.log(123);
            //   console.log(result);
              var scrollH = $(window).scrollTop() + $(window).innerHeight();
              
              console.log(scrollH);
            //   var ulH = $(".listOption").height();
            // console.log($(".listOption").children().innerHeight() * 8);
            var ulH = $(".listOption").innerHeight()  + $(".dis_header").innerHeight();
              console.log(ulH);
              if(scrollH==ulH){
                  alert("老子正在拼命给你加载");
                  setTimeout(()=>{
                  console.log(ulH);
                  console.log(scrollH);
                //   console.log(result);
                  var liHtml = template("listP",result);
                  $(".listOption").append(liHtml);
                  console.log(result);
                  result.result.splice(0,4);
                  $(".footer").show();
                  },500) 
              }
            //   } else if((scrollH-ulH)>3){
            //       result.result.splice(0,4);
            //       console.log(result);
            //   }
    })
        }
    })
})



   